package com.lp;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.TextView;

public class MainActivity extends Activity {
	private MySnake snake;
	private TextView tv;
	private FrameLayout fl;
	
	private Button left_up;
	private Button right_down;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        
        setContentView(R.layout.main);
        
        left_up = (Button)findViewById(R.id.left_up);
        right_down = (Button)findViewById(R.id.right_down);
        
        tv = (TextView)findViewById(R.id.tv);
        snake = (MySnake)findViewById(R.id.snake);
        snake.setTipMessage(tv);
        snake.setButton(left_up, right_down);
        snake.setMode(MySnake.READY);
        
        fl = (FrameLayout)findViewById(R.id.fl);
        fl.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				snake.startGameForClickFrameLayout();
			}
		});
        
    }
	@Override
	protected void onPause() {
		super.onPause();
		snake.setMode(MySnake.PAUSE);
	}
    
    
}